home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 2 code / Using C++ objects.sea / Using C++ objects / TestPtrObject.cp < prev    next >
MacBinary  |  1990-08-22  |  2.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Aug 21 20:23:51 1990, modified Tue Aug 21 20:23:51 1990, creator 'MPS ', type ASCII, 1768 bytes "TestPtrObject.cp" , at 0x768 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 10 54 65 73 74 50 74 | 72 4f 62 6a 65 63 74 2e |..TestPt|rObject.|
|00000010| 63 70 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |cp......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 06 e8 00 | 00 01 ac a2 f7 81 17 a2 |........|........|
|00000060| f7 81 17 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 36 c7 00 00 |........|....6...|
|00000080| 2f 2f 20 54 65 73 74 50 | 74 72 4f 62 6a 65 63 74 |// TestP|trObject|
|00000090| 2e 63 70 0d 23 69 6e 63 | 6c 75 64 65 20 3c 54 79 |.cp.#inc|lude <Ty|
|000000a0| 70 65 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |pes.h>.#|include |
|000000b0| 3c 51 75 69 63 6b 44 72 | 61 77 2e 68 3e 0d 23 69 |<QuickDr|aw.h>.#i|
|000000c0| 6e 63 6c 75 64 65 20 3c | 46 6f 6e 74 73 2e 68 3e |nclude <|Fonts.h>|
|000000d0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 53 65 67 4c 6f |.#includ|e <SegLo|
|000000e0| 61 64 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ad.h>.#i|nclude <|
|000000f0| 45 76 65 6e 74 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |Events.h|>.#inclu|
|00000100| 64 65 20 3c 57 69 6e 64 | 6f 77 73 2e 68 3e 0d 23 |de <Wind|ows.h>.#|
|00000110| 69 6e 63 6c 75 64 65 20 | 3c 4d 65 6e 75 73 2e 68 |include |<Menus.h|
|00000120| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 54 65 78 74 |>.#inclu|de <Text|
|00000130| 45 64 69 74 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |Edit.h>.|#include|
|00000140| 20 3c 44 69 61 6c 6f 67 | 73 2e 68 3e 0d 23 69 6e | <Dialog|s.h>.#in|
|00000150| 63 6c 75 64 65 20 3c 4d | 65 6d 6f 72 79 2e 68 3e |clude <M|emory.h>|
|00000160| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 4f 53 55 74 69 |.#includ|e <OSUti|
|00000170| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|00000180| 73 74 64 69 6f 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |stdio.h>|.#includ|
|00000190| 65 20 3c 73 74 72 69 6e | 67 2e 68 3e 0d 23 69 6e |e <strin|g.h>.#in|
|000001a0| 63 6c 75 64 65 20 3c 73 | 74 64 64 65 66 2e 68 3e |clude <s|tddef.h>|
|000001b0| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 50 74 72 4f |..#inclu|de "PtrO|
|000001c0| 62 6a 65 63 74 2e 68 22 | 0d 0d 2f 2f 20 41 20 73 |bject.h"|..// A s|
|000001d0| 6d 61 6c 6c 20 63 6c 61 | 73 73 20 74 68 61 74 20 |mall cla|ss that |
|000001e0| 63 6f 6e 74 61 69 6e 73 | 20 73 6f 6d 65 20 64 61 |contains| some da|
|000001f0| 74 61 20 61 6e 64 20 61 | 20 63 6f 6e 73 74 72 75 |ta and a| constru|
|00000200| 63 74 6f 72 2c 0d 2f 2f | 20 62 75 74 20 73 70 65 |ctor,.//| but spe|
|00000210| 6e 64 73 20 61 6c 6c 20 | 6f 66 20 69 74 73 20 74 |nds all |of its t|
|00000220| 69 6d 65 20 6f 6e 20 73 | 74 72 65 65 74 20 63 6f |ime on s|treet co|
|00000230| 72 6e 65 72 73 20 63 61 | 64 67 69 6e 67 0d 2f 2f |rners ca|dging.//|
|00000240| 20 63 69 67 61 72 65 74 | 74 65 73 20 69 6e 73 74 | cigaret|tes inst|
|00000250| 65 61 64 20 6f 66 20 64 | 6f 69 6e 67 20 75 73 65 |ead of d|oing use|
|00000260| 66 75 6c 20 77 6f 72 6b | 2e 0d 63 6c 61 73 73 20 |ful work|..class |
|00000270| 54 4c 6f 75 74 20 3a 20 | 70 75 62 6c 69 63 20 50 |TLout : |public P|
|00000280| 74 72 4f 62 6a 65 63 74 | 20 7b 0d 70 75 62 6c 69 |trObject| {.publi|
|00000290| 63 3a 0d 09 2f 2f 20 4f | 75 72 20 63 6f 6e 73 74 |c:..// O|ur const|
|000002a0| 72 75 63 74 6f 72 2e 0d | 09 09 09 09 09 54 4c 6f |ructor..|.....TLo|
|000002b0| 75 74 28 29 20 7b 20 44 | 6f 43 61 64 67 65 28 29 |ut() { D|oCadge()|
|000002c0| 3b 20 7d 3b 0d 09 2f 2f | 20 41 20 72 75 64 65 20 |; };..//| A rude |
|000002d0| 6d 65 6d 62 65 72 20 66 | 75 6e 63 74 69 6f 6e 2e |member f|unction.|
|000002e0| 0d 09 76 69 72 74 75 61 | 6c 20 76 6f 69 64 09 44 |..virtua|l void.D|
|000002f0| 6f 43 61 64 67 65 28 29 | 3b 0d 70 72 69 76 61 74 |oCadge()|;.privat|
|00000300| 65 3a 0d 09 63 68 61 72 | 09 09 09 66 41 72 72 61 |e:..char|...fArra|
|00000310| 79 5b 32 35 36 5d 3b 0d | 7d 3b 0d 0d 76 6f 69 64 |y[256];.|};..void|
|00000320| 20 54 4c 6f 75 74 3a 3a | 44 6f 43 61 64 67 65 28 | TLout::|DoCadge(|
|00000330| 29 0d 7b 0d 09 73 74 72 | 63 70 79 28 66 41 72 72 |).{..str|cpy(fArr|
|00000340| 61 79 2c 22 48 65 79 20 | 62 75 64 64 79 2c 20 73 |ay,"Hey |buddy, s|
|00000350| 70 61 72 65 20 61 20 63 | 69 67 3f 22 29 3b 0d 7d |pare a c|ig?");.}|
|00000360| 3b 0d 0d 76 6f 69 64 20 | 49 6e 69 74 54 6f 6f 6c |;..void |InitTool|
|00000370| 62 6f 78 28 29 3b 09 09 | 2f 2f 20 46 6f 72 77 61 |box();..|// Forwa|
|00000380| 72 64 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 2e 0d |rd decla|ration..|
|00000390| 0d 76 6f 69 64 20 6d 61 | 69 6e 28 29 0d 7b 0d 09 |.void ma|in().{..|
|000003a0| 2f 2f 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 4d 61 |// Initi|alize Ma|
|000003b0| 63 20 54 6f 6f 6c 62 6f | 78 20 28 68 6f 20 68 75 |c Toolbo|x (ho hu|
|000003c0| 6d 29 2e 0d 09 49 6e 69 | 74 54 6f 6f 6c 62 6f 78 |m)...Ini|tToolbox|
|000003d0| 28 29 3b 0d 0d 09 2f 2f | 20 57 65 20 6e 65 65 64 |();...//| We need|
|000003e0| 20 74 68 69 73 20 6d 75 | 63 68 20 73 70 61 63 65 | this mu|ch space|
|000003f0| 20 74 6f 20 73 74 6f 72 | 65 20 74 68 65 20 6f 62 | to stor|e the ob|
|00000400| 6a 65 63 74 73 0d 09 2f | 2f 20 77 65 d5 72 65 20 |jects../|/ we.re |
|00000410| 67 6f 69 6e 67 20 74 6f | 20 69 6e 69 74 69 61 6c |going to| initial|
|00000420| 69 7a 65 20 2d 20 69 6e | 20 74 68 69 73 20 63 61 |ize - in| this ca|
|00000430| 73 65 2c 20 31 36 4b 42 | 79 74 65 73 2e 0d 09 63 |se, 16KB|ytes...c|
|00000440| 6f 6e 73 74 20 73 69 7a | 65 5f 74 20 6b 44 65 66 |onst siz|e_t kDef|
|00000450| 61 75 6c 74 48 65 61 70 | 53 69 7a 65 20 3d 20 30 |aultHeap|Size = 0|
|00000460| 78 34 30 30 30 3b 0d 0d | 09 2f 2f 20 43 72 65 61 |x4000;..|.// Crea|
|00000470| 74 65 20 61 20 68 65 61 | 70 20 66 6f 72 20 50 74 |te a hea|p for Pt|
|00000480| 72 4f 62 6a 65 63 74 73 | 20 74 6f 20 6c 69 76 65 |rObjects| to live|
|00000490| 20 69 6e 2e 0d 09 4f 53 | 45 72 72 20 68 65 61 70 | in...OS|Err heap|
|000004a0| 45 72 72 20 3d 20 50 74 | 72 4f 62 6a 65 63 74 3a |Err = Pt|rObject:|
|000004b0| 3a 41 6c 6c 6f 63 48 65 | 61 70 28 6b 44 65 66 61 |:AllocHe|ap(kDefa|
|000004c0| 75 6c 74 48 65 61 70 53 | 69 7a 65 29 3b 0d 0d 09 |ultHeapS|ize);...|
|000004d0| 2f 2f 20 49 66 20 77 65 | 20 67 6f 74 20 61 6e 20 |// If we| got an |
|000004e0| 65 72 72 6f 72 2c 20 71 | 75 69 74 20 2d 20 74 68 |error, q|uit - th|
|000004f0| 69 73 20 69 73 6e d5 74 | 20 61 20 72 65 61 6c 0d |is isn.t| a real.|
|00000500| 09 2f 2f 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2c |.// appl|ication,|
|00000510| 20 73 6f 20 77 65 20 64 | 6f 6e d5 74 20 6e 65 65 | so we d|on.t nee|
|00000520| 64 20 65 72 72 6f 72 20 | 68 61 6e 64 6c 69 6e 67 |d error |handling|
|00000530| 2c 20 72 69 67 68 74 3f | 0d 09 69 66 20 28 68 65 |, right?|..if (he|
|00000540| 61 70 45 72 72 20 21 3d | 20 6e 6f 45 72 72 29 0d |apErr !=| noErr).|
|00000550| 09 20 45 78 69 74 54 6f | 53 68 65 6c 6c 28 29 3b |. ExitTo|Shell();|
|00000560| 0d 0d 09 2f 2f 20 43 72 | 65 61 74 65 20 61 6e 20 |...// Cr|eate an |
|00000570| 6f 62 6a 65 63 74 20 2d | 20 77 69 6c 6c 20 67 6f |object -| will go|
|00000580| 20 69 6e 20 73 65 70 61 | 72 61 74 65 20 68 65 61 | in sepa|rate hea|
|00000590| 70 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 2e |p automa|tically.|
|000005a0| 0d 09 54 4c 6f 75 74 2a | 20 61 4c 6f 75 74 20 3d |..TLout*| aLout =|
|000005b0| 20 6e 65 77 20 54 4c 6f | 75 74 3b 0d 0d 09 2f 2f | new TLo|ut;...//|
|000005c0| 20 44 6f 20 74 68 61 74 | 20 76 6f 6f 64 6f 6f 20 | Do that| voodoo |
|000005d0| 74 68 61 74 20 54 4c 6f | 75 74 73 20 64 6f c9 0d |that TLo|uts do..|
|000005e0| 09 69 66 20 28 61 4c 6f | 75 74 20 21 3d 20 6e 69 |.if (aLo|ut != ni|
|000005f0| 6c 29 0d 09 20 7b 0d 09 | 09 61 4c 6f 75 74 2d 3e |l).. {..|.aLout->|
|00000600| 44 6f 43 61 64 67 65 28 | 29 3b 0d 09 09 2f 2f 20 |DoCadge(|);...// |
|00000610| 44 65 6c 65 74 65 20 6f | 75 72 20 6f 62 6a 65 63 |Delete o|ur objec|
|00000620| 74 20 6e 6f 77 20 74 68 | 61 74 20 77 65 20 68 61 |t now th|at we ha|
|00000630| 76 65 20 66 69 6e 69 73 | 68 65 64 20 77 69 74 68 |ve finis|hed with|
|00000640| 20 69 74 2e 0d 09 09 64 | 65 6c 65 74 65 20 61 4c | it....d|elete aL|
|00000650| 6f 75 74 3b 0d 09 20 7d | 0d 09 0d 09 2f 2f 20 44 |out;.. }|....// D|
|00000660| 69 73 70 6f 73 65 20 6f | 66 20 74 68 65 20 68 65 |ispose o|f the he|
|00000670| 61 70 2e 0d 09 50 74 72 | 4f 62 6a 65 63 74 3a 3a |ap...Ptr|Object::|
|00000680| 44 69 73 70 6f 73 65 48 | 65 61 70 28 29 3b 0d 09 |DisposeH|eap();..|
|00000690| 45 78 69 74 54 6f 53 68 | 65 6c 6c 28 29 3b 0d 7d |ExitToSh|ell();.}|
|000006a0| 0d 0d 76 6f 69 64 20 49 | 6e 69 74 54 6f 6f 6c 62 |..void I|nitToolb|
|000006b0| 6f 78 28 29 0d 7b 0d 09 | 2f 2f 20 53 74 61 6e 64 |ox().{..|// Stand|
|000006c0| 61 72 64 20 4d 61 63 69 | 6e 74 6f 73 68 20 69 6e |ard Maci|ntosh in|
|000006d0| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 2e 0d 09 49 |itializa|tion...I|
|000006e0| 6e 69 74 47 72 61 66 28 | 28 50 74 72 29 20 26 71 |nitGraf(|(Ptr) &q|
|000006f0| 64 2e 74 68 65 50 6f 72 | 74 29 3b 0d 09 49 6e 69 |d.thePor|t);..Ini|
|00000700| 74 46 6f 6e 74 73 28 29 | 3b 0d 09 49 6e 69 74 57 |tFonts()|;..InitW|
|00000710| 69 6e 64 6f 77 73 28 29 | 3b 0d 09 49 6e 69 74 4d |indows()|;..InitM|
|00000720| 65 6e 75 73 28 29 3b 0d | 09 54 45 49 6e 69 74 28 |enus();.|.TEInit(|
|00000730| 29 3b 0d 09 49 6e 69 74 | 44 69 61 6c 6f 67 73 28 |);..Init|Dialogs(|
|00000740| 6e 69 6c 29 3b 0d 09 49 | 6e 69 74 43 75 72 73 6f |nil);..I|nitCurso|
|00000750| 72 28 29 3b 0d 09 4d 61 | 78 41 70 70 6c 5a 6f 6e |r();..Ma|xApplZon|
|00000760| 65 28 29 3b 0d 7d 0d 0d | 00 00 00 00 00 00 00 00 |e();.}..|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000780| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00000790| 2e 63 70 0d 23 69 6e 63 | 6c 75 64 65 20 3c 54 79 |.cp.#inc|lude <Ty|
|000007a0| 70 65 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |pes.h>.#|include |
|000007b0| 10 54 65 73 74 50 74 72 | 4f 62 6a 65 63 74 2e 63 |.TestPtr|Object.c|
|000007c0| 70 73 02 00 00 00 54 45 | 58 54 4d 50 53 20 01 00 |ps....TE|XTMPS ..|
|000007d0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 40 00 00 |..TEXTMP|S ...@..|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 a2 ec 57 65 00 00 | 06 e8 00 00 01 ac 6c 75 |....We..|......lu|
|00000800| 64 65 20 3c 57 69 6e 64 | 6f 77 73 2e 68 3e 0d 23 |de <Wind|ows.h>.#|
|00000810| 69 6e 63 6c 75 64 65 20 | 3c 4d 65 6e 75 73 2e 68 |include |<Menus.h|
|00000820| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 54 65 78 74 |>.#inclu|de <Text|
|00000830| 45 64 69 74 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |Edit.h>.|#include|
|00000840| 20 3c 44 69 61 6c 6f 67 | 73 2e 68 3e 0d 23 69 6e | <Dialog|s.h>.#in|
|00000850| 63 6c 75 64 65 20 3c 4d | 65 6d 6f 72 79 2e 68 3e |clude <M|emory.h>|
|00000860| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 4f 53 55 74 69 |.#includ|e <OSUti|
|00000870| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|00000880| 00 00 00 1e 00 34 02 1e | 03 75 04 08 00 34 02 1e |.....4..|.u...4..|
|00000890| 03 75 04 08 00 00 03 11 | 00 00 00 00 00 00 00 00 |.u......|........|
|000008a0| 00 00 00 00 00 48 00 0c | 4d 6f 6e 61 63 6f 00 f6 |.....H..|Monaco..|
|000008b0| 00 1e 00 09 01 f5 7f ff | 00 1f 01 f5 01 f6 7f ff |........|........|
|000008c0| 03 73 00 09 00 0a 7f ff | 00 07 00 04 00 3c 00 24 |.s......|.....<.$|
|000008d0| 01 dd 02 3d 00 3c 00 24 | 01 dd 02 3d a2 f7 17 9f |...=.<.$|...=....|
|000008e0| 00 00 05 db 00 00 05 db | 00 00 04 b9 01 00 00 00 |........|........|
|000008f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 23 |.....n..|.n...>.#|
|00000900| 24 cc 0d 98 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |$.......|.>..MPSR|
|00000910| 00 01 00 0a 03 f0 ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00000920| 03 ed ff ff 00 00 00 22 | 00 24 c8 f8 00 00 00 00 |......."|.$......|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+